<!-- 404.vue -->
<template>
  <div class="not-found-container">
    <div class="error-content">
      <!-- 404 图标 -->
      <div class="error-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
          <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
          <line x1="12" y1="9" x2="12" y2="13"></line>
          <line x1="12" y1="17" x2="12.01" y2="17"></line>
        </svg>
      </div>

      <!-- 错误信息 -->
      <h1 class="error-code">404</h1>
      <p class="error-message">抱歉，页面找不到了</p>

      <!-- 返回按钮 -->
      <div class="action-buttons">
        <button class="btn btn-primary" @click="goBack">返回上一页</button>
        <button class="btn btn-secondary" @click="goHome">回到首页</button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

// 返回上一页
const goBack = () => {
  router.go(-1)
}

// 跳转到首页
const goHome = () => {
  router.push('/')
}
</script>

<style scoped>
.not-found-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.error-content {
  text-align: center;
  color: #333;
  padding: 2rem;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(118, 171, 106, 0.3);
  max-width: 500px;
  width: 100%;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(118, 171, 106, 0.2);
  animation: slideUp 0.8s ease-out;
}

.error-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  background: #76ab6a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
  box-shadow: 0 4px 15px rgba(118, 171, 106, 0.4);
}

.error-icon svg {
  width: 40px;
  height: 40px;
}

.error-code {
  font-size: 6rem;
  font-weight: bold;
  margin: 0 0 1rem;
  color: #76ab6a;
  text-shadow: 2px 2px 4px rgba(118, 171, 106, 0.2);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.error-message {
  font-size: 1.5rem;
  margin: 0 0 2rem;
  color: #333;
  font-weight: 500;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid #76ab6a;
  border-radius: 25px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
}

.btn-primary {
  background: #76ab6a;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(118, 171, 106, 0.4);
  background: #6a9f5f;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: #76ab6a;
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(118, 171, 106, 0.3);
  background: rgba(118, 171, 106, 0.1);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .error-content {
    margin: 10px;
    padding: 1.5rem;
  }
  
  .error-code {
    font-size: 4rem;
  }
  
  .error-message {
    font-size: 1.2rem;
  }
  
  .btn {
    min-width: 100px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .error-code {
    font-size: 3rem;
  }
  
  .error-message {
    font-size: 1rem;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 200px;
  }
}

/* 动画效果 */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 与全局动画类兼容 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

.card-drop-enter-active,
.card-drop-leave-active {
  transition: transform 0.5s;
}

.card-drop-enter-from,
.card-drop-leave-to {
  transform: translateY(-50px);
}
</style>